// 统一管理用户相关的接口
import request from '@/utils/request'
import type {
  CommonResponseData,
  LoginFormData,
  LoginResponseData,
  UserInfoData,
} from './type'

// 统一管理接口
const enum Api {
  LOGIN_URL = '/user/login',
  USERINFO_URL = '/user/userInfo',
}

// 暴露请求函数
// 登录请求接口方法
export const reqLogin = (data: LoginFormData) =>
  request.post<any, CommonResponseData<LoginResponseData>>(Api.LOGIN_URL, data)
// 获取用户信息接口方法
export const reqUserInfo = (phone: string) =>
  request.get<any, CommonResponseData<UserInfoData>>(
    Api.USERINFO_URL + '?phone=' + phone
  )
